<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<head>
	<%@include file="/include.jsp"%>
<link href="${ctx}/css/style.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/css/table.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/dwz/themes/default/style.css" rel="stylesheet" type="text/css" media="screen" />
<link href="${ctx}/dwz/themes/css/core.css" rel="stylesheet" type="text/css" media="screen" />
<SCRIPT language="Javascript" type="text/javascript" src="dtreeck.js"></SCRIPT>
<SCRIPT language="Javascript" type="text/javascript" src="jquery.js"></SCRIPT>
</head>
<body topmargin="0" leftmargin="0">
<table border="0" cellpadding="0" cellspacing="0" class="table_border">
    <tr>
        <td>
            <table width="100%" border="0" cellpadding="0" cellspacing="0"
                   class="table_padding">
                <tr>
                	<td>
                		<table align="left" style="width: 52%; border: 1px">
                    		<tr>
                    			<td>报销人：
                    				<input type="text"
										id="menu_parent_name"  readonly="readonly" style="width: 80px;" placeholder="请选择部门"> <input
										type="hidden" id="menu_parent" name="menu_parent">
									<!-- 父菜单id --> <input type="hidden" id="oprate"
										name="oprate"  readonly="readonly">
									<!-- radio --> <input type="hidden" id="menu_id"
										name="menu_id"  readonly="readonly">
										<select>
										<option selected="selected">请选择报销人</option>
										<option>后勤1</option>
										<option>后勤2</option>
										<option>后勤3</option>
										<option>后勤4</option>
										<option>学管1</option>
										<option>学管2</option>
										<option>学管3</option>
										<option>学管4</option>
										<option>招生1</option>
										<option>招生2</option>
										<option>招生3</option>
										<option>招生4</option>
										<option>讲师1</option>
										<option>讲师2</option>
										<option>讲师3</option>
										<option>讲师4</option>
									</select>
								</td>
								<div id="treediv"
														style="display: none; position: absolute; overflow: scroll; width: 150px; height: 200px; padding: 5px; background: #fff; color: #fff; border: 1px solid #cccccc">
														<div align="right">
															<a href="##" id="closed"><font color="blue">关闭&nbsp;</font></a>
														</div>
														<script language="JavaScript" type="text/JavaScript">
				//树代码
				mydtree = new dTree('mydtree','imgmenu/','no','no');
				mydtree.add(0,
					  -1,
					  "逸天教育科技有限公司",
					  "javascript:setvalue('0','逸天教育科技有限公司')",
					  "根目录",
					  "_self",
					  false);
				
				mydtree.add(11,
				0,
				'管理部',
				"javascript:setvalue('11','管理部')",
				'管理部',
				'_self',
				false);
				
				mydtree.add(12,
				0,
				'讲师部',
				"javascript:setvalue('12','讲师部')",
				'讲师部',
				'_self',
				false);
				
				mydtree.add(13,
				0,
				'学管部',
				"javascript:setvalue('13','学管部')",
				'学管部',
				'_self',
				false);
				
				mydtree.add(14,
				0,
				'招生部',
				"javascript:setvalue('14','招生部')",
				'招生部',
				'_self',
				false);
				
				mydtree.add(15,
				0,
				'后勤部',
				"javascript:setvalue('15','后勤部')",
				'后勤部',
				'_self',
				false);
				
				mydtree.add(16,
				0,
				'财务部',
				"javascript:setvalue('16','财务部')",
				'财务部',
				'_self',
				false);
				
			   document.write(mydtree);
			   
			</script>
													</div>
                    			<td>报销项目：
                    				<select>
										<option selected="selected">请选择报销项目</option>
										<option>费用1</option>
										<option>费用2</option>
										<option>费用3</option>
										<option>费用4</option>
										<option>其他</option>
									</select>
                    			</td>
                    			<td width="50px"><a class="button" href="#"><span>查询</span></a>
                    			<td width="50px"><a class="button" href="#"><span>取消</span></a>
                    		</tr>
                    		<tr>
                    			
                    		</tr>
                    	</table>
                	</td>
                </tr>
                <tr>
                    <td>
                        <table align="left">
                            <tr>
                                <td width="50px"><a class="button" href="add.jsp"><span>新增</span></a>
                                </td>
                                <td width="50px"><a class="button"
                                                    href="javascript:void(0);"><span>删除</span></a></td>
                                <td width="50px"><a class="button" href="edit.jsp"><span>修改</span></a>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td width="25" height="26" align="right"></td>
                </tr>
            </table>
        </td>
    </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td align="center">
            <table border="1" cellpadding="0" cellspacing="0" id="box_num_table2"
                   class="box_num_table">
                <thead>
                <tr  bgcolor="white">
                    <td><input type="checkbox"  onclick="checkAll(this)"/></td>
                    <td>序号</td>
                    <td>报销项目</td>
                    <td>报销金额</td>
                    <td>报销人</td>
                    <td>报销方式</td>
                    <td>操作人</td>
                    <td>备注</td>
                </tr>
                </thead>
                <tbody>
                <tr  bgcolor="white">
                    <td><input class="aaa" type="checkbox" onclick="checkA()"/></td>
                    <td>1</td>
                    <td>车费</td>
                    <td>1000</td>
                    <td>报销人1</td>
                    <td>现金</td>
                    <td>操作人1</td>
                    <td>租大巴费用</td>
                </tr>
                <tr  bgcolor="white">
                    <td><input class="aaa" type="checkbox" onclick="checkA()"/></td>
                    <td>2</td>
                    <td>宽带安装</td>
                    <td>250</td>
                    <td>报销人2</td>
                    <td>现金</td>
                    <td>操作人1</td>
                    <td>联通光纤安装费</td>
                </tr>
                </tbody>
            </table>
        </td>
    </tr>
    <tr>
        <td>
            <table border="0" cellpadding="0" cellspacing="0"
                   class="table_border">
                <tr>
                    <td>
                        <table width="100%" border="0" cellpadding="0" cellspacing="0"
                               class="table_padding">
                            <tr>
                                <td width="8%" class="font_left">数据:120条</td>
                                <td width="12" class="font_left">第</td>
                                <td width="375" class="font_left">
                                    <input name="textfield2" type="text" size="2" maxlength="4" /> /5页
                                </td>
                                <td width="478" class="font_right">
                                    <a href="">首页</a>
                                    <a href="">上一页</a>
                                    <a href="">下一页</a>
                                    <a href="">末页</a>
                                    <a href="">刷新</a>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>

        </td>
    </tr>
</table>
<script type="text/javascript">
//生成弹出层的代码
<!-- 弹出层-->
xOffset = 0;//向右偏移量
yOffset = 25;//向下偏移量
var toshow = "treediv";//要显示的层的id
var target = "menu_parent_name";//目标控件----也就是想要点击后弹出树形菜单的那个控件id
$("#"+target).click(function (){
	$("#"+toshow)
	.css("position", "absolute")
	.css("left", $("#"+target).position().left+xOffset + "px")
	.css("top", $("#"+target).position().top+yOffset +"px").show();
});
//关闭层
$("#closed").click(function(){
	$("#"+toshow).hide();
});
//判断鼠标在不在弹出层范围内
 /* function   checkIn(id){
	var yy = 20;   //偏移量
	var str = "";
	var   x=window.event.clientX;   
	var   y=window.event.clientY;   
	var   obj=$("#"+id)[0];
	if(x>obj.offsetLeft&&x<(obj.offsetLeft+obj.clientWidth)&&y>(obj.offsetTop-yy)&&y<(obj.offsetTop+obj.clientHeight)){   
		return true;
	}else{   
		return false;
	}   
  }    */
//点击body关闭弹出层
	/* $(document).click(function(){
		var is = checkIn("treediv");
		if(!is){
			$("#"+toshow).hide();
		}
	}); */
<!-- 弹出层-->
//生成弹出层的代码
//点击菜单树给文本框赋值------------------菜单树里加此方法
function setvalue(id,name){
	$("#menu_parent_name").val(name);
	$("#menu_parent").val(id);
	$("#treediv").hide();
}

function checkA(){
			
	 var l=$(":checkbox:not(:first)");
		var ll=$(":checkbox:not(:first):checked");
		l.click(function(){
	/* l.each(function(){
		if(!$(this).attr("checked")){
			$("#box_num_table2 input[type='checkbox']:first").prop('checked',false);
			return;
		}
		
		
		}) */
		if(l.length==ll.length){
			$("#box_num_table2 input[type='checkbox']:first").prop('checked', true);
		}else{
			$("#box_num_table2 input[type='checkbox']:first").prop('checked',false);
		}
		
}) 
}
  
	

function checkAll(obj){
    $("#box_num_table2 input[type='checkbox']").prop('checked', $(obj).prop('checked'));
}

/* $("#box_num_table2 :checkbox:not(:first)").click(function(){
	
	$("#box_num_table2 input[type='checkbox']:first").prop('checked',false);
}) */



</script>
